<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	template="/WEB-INF/template/template2.xhtml">

	<ui:define name="content1">
		<h:form id="form">
			<p:growl id="messages" showDetail="true" />
			<div class="container">
				<h2 style="margin-left:600px !important; ">
				User data </h2>
				<p:panelGrid styleClass="table" columns="2">

					<h:outputText value="Name" />
					<p:inputText value="#{userViewBean.newUser.name}" required="true" requiredMessage="Enter name"/>

					<h:outputText value="Username" />
					<p:inputText value="#{userViewBean.newUser.username}" required="true" requiredMessage="Enter username"/>

					<h:outputText value="Password" />
					<p:password value="#{userViewBean.newUser.password}" required="true" requiredMessage="Enter password"/>

					<h:outputText value="Usertype" />
					<p:selectOneMenu value="#{userViewBean.newUser.userType}"
						style="width:100%" required="true" requiredMessage="Chose an usertype">
						<f:selectItem itemLabel="Select One" itemValue="" />
						<f:selectItem itemLabel="Owner" itemValue="Owner" />
						<f:selectItem itemLabel="User" itemValue="User" />
					</p:selectOneMenu>

				</p:panelGrid>

				<br />
				<h2 style="margin-left:600px !important;">
				User privilege</h2>
				<p:panelGrid styleClass="table" id="privGrid" columns="2">

					<h:outputText value="House Lock" />
					<p:selectBooleanCheckbox value="#{userViewBean.newPrivilege.houseLook}" />

					<h:outputText value="Lights" />
					<p:selectBooleanCheckbox value="#{userViewBean.newPrivilege.lights}" />

					<h:outputText value="Room temperature" />
					<p:selectBooleanCheckbox value="#{userViewBean.newPrivilege.temp}" />

					<h:outputText value="Room electricity" />
					<p:selectBooleanCheckbox value="#{userViewBean.newPrivilege.roomEl}" />

				</p:panelGrid>
				
				<p:commandButton style="margin-left:600px !important;" value="Submit user" action="#{userViewBean.submitUser}" ajax="false"/>
			</div>
		</h:form>
	</ui:define>

</ui:composition>
